﻿@page "/BarGaugePalette"

<DemoPageSectionComponent Id="BarGauge-Palette">
    <DemoChildContent>
        <DxBarGauge Width="100%"
                    Height="500px"
                    StartValue="-5"
                    EndValue="5"
                    BaseValue="0"
                    PaletteExtensionMode="@CurrentPaletteMode"
                    Palette="@Colors[CurrentPalette]"
                    Values="@Values">

            <DxBarGaugeLabelSettings>
                <DxTextFormatSettings LdmlString="@LabelFormat" />
            </DxBarGaugeLabelSettings>

            <DxBarGaugeLegendSettings Visible="true"
                                      ItemCaptions="@LegendItemCaptions"
                                      VerticalAlignment="VerticalEdge.Bottom"
                                      HorizontalAlignment="HorizontalAlignment.Center"/>

            <DxExportSettings Enabled="@ExportEnabled" />

            <DxTitleSettings Text="Deviations in Manufactured Parts">
                <DxFontSettings Size="28" Weight="600" />
            </DxTitleSettings>

            <DxTooltipSettings Enabled="true" Color="lightyellow">
                <DxTextFormatSettings LdmlString="@LabelFormat" />
            </DxTooltipSettings>

        </DxBarGauge>

        @code {
            string LabelFormat = "##.## mm;-##.## mm";
            [Parameter] public bool ExportEnabled { get; set; }

            public enum Palettes {
                Material,
                Bootstrap,
                Tailwind
            }

            Dictionary<Palettes, string[]> Colors = new Dictionary<Palettes, string[]>() {
                { Palettes.Material, new string[] { "#1db2f5", "#f5564a", "#97c95c" } },
                { Palettes.Bootstrap, new string[] { "#0d6efd", "#6c757d", "#28a745" } },
                { Palettes.Tailwind, new string[] { "#ef4444", "#eab308", "#22c55e" } }
            };

            Palettes CurrentPalette = Palettes.Material;
            PaletteExtensionMode CurrentPaletteMode = PaletteExtensionMode.Alternate;

            double[] Values = new double[] { -2.13, 1.48, -3.09, 4.52, 4.9, 3.9 };
            string[] LegendItemCaptions = new string[] { "Shaft", "Screw", "Bolt", "Washer", "Pin", "Bushing" };
        }
    </DemoChildContent>
    <OptionsContent>
        <OptionComboBox Label="Palette:" Data="Enum.GetValues<Palettes>()" @bind-Value="@CurrentPalette" />
        <OptionComboBox Label="Palette Extension Mode:" Data="Enum.GetValues<PaletteExtensionMode>()" @bind-Value="@CurrentPaletteMode" />
        <OptionCheckBox T="bool"
                        @bind-Checked="ExportEnabled"
                        Label="Enable Export" />
    </OptionsContent>
</DemoPageSectionComponent>
